//
//  ImageCollectionViewCell.m
//  UI_APP_Project_Bean
//
//  Created by dllo on 16/6/24.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "ImageCollectionViewCell.h"
#import "MovieModel.h"

@interface ImageCollectionViewCell ()

@property(nonatomic, retain)UIImageView *picView;
@property(nonatomic, retain)UILabel *labelName;

@end


@implementation ImageCollectionViewCell
- (void)dealloc
{
    [_picView release];
    [_labelName release];
    [_movieViewModel release];
    [super dealloc];
}

-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        
        self.picView = [[UIImageView alloc]init];
        [self.contentView addSubview:_picView];
        [_picView release];
        
        
        self.labelName = [[UILabel alloc]init];
        self.labelName.textAlignment = 1;
        [self.contentView addSubview:_labelName];
        [_labelName release];
        
        
    }
    
    return self;
    
}

-(void)layoutSubviews{
    
    self.picView.frame = CGRectMake(10, 10, self.contentView.frame.size.width - 20, self.contentView.frame.size.height - 40);
    
    self.labelName.frame = CGRectMake(10, _picView.frame.size.height + 15, self.contentView.frame.size.width, 30);
    
    
}
-(void)setMovieViewModel:(MovieModel *)movieViewModel{

    if (_movieViewModel != movieViewModel) {
        [_movieViewModel release];
        _movieViewModel = [movieViewModel retain];
    }
    self.picView.image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString: movieViewModel.pic_url]]];
    
    self.labelName.text =movieViewModel.movieName;
    
    
    
}






@end
